<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
	<script>
		var name ="abcabcabcabc";
		var acount=0;
		var weizhi= name.indexOf("a");
		while(weizhi !=-1){
			weizhi=name.indexOf("a",weizhi+1);
			acount++;
		}
		alert(acount);
		
	</script>	
	</body>
</html>
